#include <stdio.h>
#include <unistd.h>
int global_value = 100;
int main()
{
    pid_t id = fork();
    if(id < 0 )
    {
        printf("fork error\n");
    }
    else if( id == 0 )
    {
        int cnt = 0;
        while(1)
        {
            printf("i am child ,pid = %d,ppid = %d,global_value = %d ,&global_valueo=%p\n",getpid(),getppid(),global_value,&global_value);
            cnt++;
            if(cnt ==10)
            {
                global_value = 300;
                printf("child had changed  global_value!...............................................\n");
            }
            sleep(1);
        }
        
    }
    else
    {
        while(1)
        {
            printf("i am father ,pid = %d,ppid = %d,global_value = %d ,&global_valueo=%p\n",getpid(),getppid(),global_value,&global_value);
            sleep(2);
        }
    }
    return 0;
}
